import sys
from fetch_data import main as fetch_data
from run_backtest import main as run_backtest

def main():
    """运行完整的分析流程"""
    print("步骤 1: 获取历史数据")
    try:
        fetch_data()
    except Exception as e:
        print(f"数据获取失败: {str(e)}")
        sys.exit(1)
    
    print("\n步骤 2: 运行回测分析")
    try:
        run_backtest()
    except Exception as e:
        print(f"回测分析失败: {str(e)}")
        sys.exit(1)
    
    print("\n分析流程完成！")

if __name__ == "__main__":
    main() 